#include "mylinenumedit.h"
#include "QVBoxLayout"
#include <QDialog>
using namespace AeaQt;
MyLineNumEdit::MyLineNumEdit(QWidget *parent) : QLineEdit(parent)
{

}
void MyLineNumEdit::mousePressEvent(QMouseEvent *e)
{
//    if(e->button() == Qt::LeftButton)    //鼠标左键点击触发signal
//    {
//        emit clicked();
//    }
#ifdef ENABLED_WQY_FONT
    int fontId = QFontDatabase::addApplicationFont(":/Font/wqy-microhei.ttc");
    QStringList stringList = QFontDatabase::applicationFontFamilies(fontId);
    QFont font(stringList.first());
    a.setFont(font);
#endif

    QDialog *dlg = new QDialog(this);//创建对话框对象，参数：父窗口
    NumberKeyboard keyboard;
    keyboard.setParent(dlg);
    keyboard.show();
    dlg->resize(450, 370);
    dlg->setWindowTitle(QStringLiteral("模态对话框"));
    QLineEdit* textInput = new QLineEdit(&keyboard);
    connect(textInput,&QLineEdit::textChanged,this,[=](){
        this->setText(textInput->text());
    });
    textInput->setText(this->text());
    textInput->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    QString qss = "                               \
                                QLineEdit {                    \
                                    border-style: none;        \
                                    padding: 3px;              \
                                    border-radius: 5px;        \
                                    border: 1px solid #dce5ec; \
                                    font-size: 30px;           \
                                }                              \
                                ";
    textInput->setStyleSheet(qss);
    QVBoxLayout *v = new QVBoxLayout;
    v->addWidget(textInput, 1);
    v->addWidget(&keyboard, 5);
    dlg->setLayout(v);
    dlg->exec();
}

